package com.shallowUniverse.process.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.shallowUniverse.process.entity.ProcessNodeDefinition;
import com.shallowUniverse.process.mapper.provider.ProcessNodeDefinitionProvider;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author gs
 * @date create in 2020/12/11 16:02
 */
@Repository
public interface ProcessNodeDefinitionMapper {

    @SelectProvider(type = ProcessNodeDefinitionProvider.class, method = "selectById")
    List<ProcessNodeDefinition> selectById(String id);

    @SelectProvider(type = ProcessNodeDefinitionProvider.class, method = "selectFirtstNode")
    List<ProcessNodeDefinition> selectFirtstNode(Long processId);

    @SelectProvider(type = ProcessNodeDefinitionProvider.class, method = "selectNextNode")
    List<ProcessNodeDefinition> selectNextNode(ProcessNodeDefinition processNodeDefinition);

    @SelectProvider(type = ProcessNodeDefinitionProvider.class, method = "selectFieldValue")
    String selectFieldValue(Map<String, String> params);

    @InsertProvider(type = ProcessNodeDefinitionProvider.class, method = "insert")
    int insert(ProcessNodeDefinition processNodeDefinition);

    @InsertProvider(type = ProcessNodeDefinitionProvider.class, method = "insertBatch")
    int insertBatch(List<ProcessNodeDefinition> processNodeDefinitions);

    @InsertProvider(type = ProcessNodeDefinitionProvider.class, method = "update")
    int update(ProcessNodeDefinition processNodeDefinition);

    @SelectProvider(type = ProcessNodeDefinitionProvider.class,method = "selectList")
    List<ProcessNodeDefinition> selectList(ProcessNodeDefinition processNodeDefinition);

    @DeleteProvider(type = ProcessNodeDefinitionProvider.class,method = "deleteLogic")
    int deleteLogic(String id);

    @DeleteProvider(type = ProcessNodeDefinitionProvider.class,method = "delete")
    int delete(String id);

    @DeleteProvider(type = ProcessNodeDefinitionProvider.class,method = "deleteByProcessLogic")
    int deleteByProcessLogic(String processId);

    @DeleteProvider(type = ProcessNodeDefinitionProvider.class,method = "deleteByProcess")
    int deleteByProcess(String processId);

    @SelectProvider(type = ProcessNodeDefinitionProvider.class,method = "selectList")
    IPage<ProcessNodeDefinition> selectPageList(IPage<ProcessNodeDefinition> page, ProcessNodeDefinition processNodeDefinition);

    @SelectProvider(type = ProcessNodeDefinitionProvider.class,method = "selectMaxNodeByRole")
    List<ProcessNodeDefinition> selectMaxNodeByRole(Map<String, String> params);
}
